#include "itemdef.h"
#include "ui_itemdef.h"

ItemDef::ItemDef(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ItemDef)
{
    ui->setupUi(this);

    this->setParent(parent);
    this->setWindowFlags(Qt::CustomizeWindowHint|Qt::FramelessWindowHint);

}

ItemDef::~ItemDef()
{
    delete ui;
}

//一级标题
void ItemDef::headline1(QString data)
{
    QFont font;
    font.setFamily(QStringLiteral("Microsoft YaHei"));//设置字体
    font.setPixelSize(22);//字体大小
    font.setLetterSpacing(QFont::PercentageSpacing,120);//120字间距，默认100
    ui->label_2->setFont(font);

    ui->label_2->setText(data);

}

//二级标题
void ItemDef::headline2(QString data)
{
    QFont font;
    font.setFamily(QStringLiteral("Microsoft YaHei"));//设置字体
    font.setPixelSize(20);//字体大小
    font.setLetterSpacing(QFont::PercentageSpacing,120);//120字间距，默认100
    ui->label_2->setFont(font);

    ui->label_2->setText(data);
    ui->label_2->setGeometry(116,0,300,60);
    this->resize(300,60);
}

//显示图片路径
void ItemDef::setIcon(QString path)
{
    ui->label->setPixmap(QPixmap(path));
}

void ItemDef::setPbStyle(QString data)
{
    ui->pushButton_2->setStyleSheet(data);
}

void ItemDef::setLI(int l, int i)
{
    nLevel = l;
    nIndex = i;
}

//点击了窗口
void ItemDef::on_pushButton_clicked()
{
    emit sendItemDef(nLevel, nIndex);
}
